﻿using strange.extensions.dispatcher.eventdispatcher.api;
using strange.extensions.mediation.impl;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 作为一个中介 让View与外界访问
/// </summary>
public class StartMediator : EventMediator {

    [Inject]
	public StartView StartView{get;set;}

  
    public override void OnRegister()
    {
        StartView.Init();

        StartView.dispatcher.AddListener(ViewEvent.View_ChangeMultiple, OnViewClick);
    }

    public override void OnRemove()
    {
        StartView.dispatcher.RemoveListener(ViewEvent.View_ChangeMultiple, OnViewClick);
    }

    /// <summary>
    /// 监听到事件的回调方法
    /// </summary>
    /// <param name="evt"></param>
    public void OnViewClick(IEvent evt)
    {
        int multiple = (int)evt.data;
        //派发事件命令
        dispatcher.Dispatch(CommandEvent.Command_ChangeMultiple, multiple);

    }
}
